package pointAndLine;

import returnTypes.Status;

public class Point {
	private double x = 0 ;
	private double y = 0 ;
	private String pointName = null;
	private Status state;
	
	public Point(double x, double y)
	{
		this.x=x;
		this.y=y;
	}
	
	public Point(String coordinates)
	{
		String xStr=new String();
		String yStr=new String();
		int i=coordinates.indexOf(',');
		xStr=coordinates.substring(1,i);
		yStr=coordinates.substring(i+1,coordinates.length()-1);
		this.x=Double.parseDouble(xStr);
		this.y=Double.parseDouble(yStr);
	}
	
	public Point() {
		
	}
	/**
	 * @param x the x to set
	 */
	public void setX(double x) {
		this.x = x;
	}
	/**
	 * @return the x
	 */
	public double getX() {
		return x;
	}
	/**
	 * @param y the y to set
	 */
	public void setY(double y) {
		this.y = y;
	}
	/**
	 * @return the y
	 */
	public double getY() {
		return y;
	}
	
	
	public boolean equals(Point point)
	{
		if( (this.x==point.x) && (this.y==point.y) ) return true;
		return false;
	}
	
	public String toString()
	{
		return "( "+this.x+","+this.y+" )"; 
	}
	public void setPointName(String pointName) {
		this.pointName = pointName;
	}
	public String getPointName() {
		return pointName;
	}
	public int getCmX() {
		return (int)(x*10);
	}
	public int getCmY() {
		return (int)(y*10);
	}

	public void setState(Status state) {
		this.state = state;
	}

	public Status getState() {
		return state;
	}
	
}
